﻿using System;
using System.Collections.Generic;
using System.Linq;
using Character;
using RootMotion.FinalIK;
using SEXY;
using UniRx;
using UnityEngine;
using Utility;

// Token: 0x02000143 RID: 323
public class Female : Human
{
	// Token: 0x170000E1 RID: 225
	// (get) Token: 0x06000794 RID: 1940 RVA: 0x0002CE7C File Offset: 0x0002B07C
	// (set) Token: 0x06000795 RID: 1941 RVA: 0x0002CE84 File Offset: 0x0002B084
	public HEROINE HeroineID
	{
		get
		{
			return this.heroineID;
		}
		set
		{
			this.SetHeroineID(value);
		}
	}

	// Token: 0x170000E2 RID: 226
	// (get) Token: 0x06000796 RID: 1942 RVA: 0x0002CE90 File Offset: 0x0002B090
	public Personality personality
	{
		get
		{
			return GlobalData.PlayData.GetHeroinePersonality(this.HeroineID);
		}
	}

	// Token: 0x170000E3 RID: 227
	// (get) Token: 0x06000797 RID: 1943 RVA: 0x0002CEA4 File Offset: 0x0002B0A4
	// (set) Token: 0x06000798 RID: 1944 RVA: 0x0002CEAC File Offset: 0x0002B0AC
	public float NipAdd { get; private set; }

	// Token: 0x170000E4 RID: 228
	// (get) Token: 0x06000799 RID: 1945 RVA: 0x0002CEB8 File Offset: 0x0002B0B8
	// (set) Token: 0x0600079A RID: 1946 RVA: 0x0002CEC0 File Offset: 0x0002B0C0
	public float SkinSmoothAdd { get; private set; }

	// Token: 0x170000E5 RID: 229
	// (get) Token: 0x0600079B RID: 1947 RVA: 0x0002CECC File Offset: 0x0002B0CC
	// (set) Token: 0x0600079C RID: 1948 RVA: 0x0002CED4 File Offset: 0x0002B0D4
	public bool ShowVirginBlood { get; private set; }

	// Token: 0x170000E6 RID: 230
	// (get) Token: 0x0600079D RID: 1949 RVA: 0x0002CEE0 File Offset: 0x0002B0E0
	// (set) Token: 0x0600079E RID: 1950 RVA: 0x0002CEE8 File Offset: 0x0002B0E8
	public WEAR_SHOW[] wearShow { get; set; }

	// Token: 0x0600079F RID: 1951 RVA: 0x0002CEF4 File Offset: 0x0002B0F4
	private void Awake()
	{
		base.sex = SEX.FEMALE;
		base.visibleAll = true;
		this.wearShow = new WEAR_SHOW[14];
		Transform parent = Transform_Utility.FindTransform(base.transform, "cf_J_Head_s");
		this.mosaicRoot = Transform_Utility.FindTransform(base.transform, "N_mnpb");
		DynamicBone_Ver02 bustDynamicBone_L = null;
		DynamicBone_Ver02 bustDynamicBone_R = null;
		DynamicBone_Ver02[] componentsInChildren = base.gameObject.GetComponentsInChildren<DynamicBone_Ver02>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (componentsInChildren[i].Comment == "muneL")
			{
				bustDynamicBone_L = componentsInChildren[i];
			}
			else if (componentsInChildren[i].Comment == "muneR")
			{
				bustDynamicBone_R = componentsInChildren[i];
			}
		}
		this.neckLook = base.transform.GetComponentInChildren<LookAtRotator>();
		base.customParam = new CustomParameter(SEX.FEMALE);
		base.SetDefParam();
		base.head = new Head(this, parent);
		base.body = new Body(this, bustDynamicBone_L, bustDynamicBone_R);
		base.hairs = new Hairs(this, null);
		base.wears = new Wears(base.sex, base.customParam.wear, base.transform, this);
		base.accessories = new Accessories(base.sex, base.transform);
		this.bustNormalMgr = new NormalLerpManager(base.transform, this.bustNormal);
		this.nipNormal.Setup();
		this.nipUVMgr = new UVLerpManager(this.nipNormal, this.nipUV);
		base.ik = new IK_Control(base.GetComponentInChildren<FullBodyBipedIK>(), null, null, null);
		this.SetTongueType(TONGUE_TYPE.FACE);
		this.NipAdd = 0f;
		this.heroineID = HEROINE.NUM;
	}

	// Token: 0x060007A0 RID: 1952 RVA: 0x0002D098 File Offset: 0x0002B298
	public void SetHeroineID(HEROINE heroine)
	{
		this.heroineID = heroine;
	}

	// Token: 0x060007A1 RID: 1953 RVA: 0x0002D0A4 File Offset: 0x0002B2A4
	private void Start()
	{
	}

	// Token: 0x060007A2 RID: 1954 RVA: 0x0002D0A8 File Offset: 0x0002B2A8
	protected override void Update()
	{
		base.Update();
		this.Update_SpermHitTimer();
		this.Update_FlushAndTear(false);
		base.wears.UpdateLiquid(this.sperms);
	}

	// Token: 0x060007A3 RID: 1955 RVA: 0x0002D0D0 File Offset: 0x0002B2D0
	private void Update_SpermHitTimer()
	{
		for (int i = 0; i < this.spermHitTimer.Length; i++)
		{
			if (this.spermHitTimer[i] > 0f)
			{
				this.spermHitTimer[i] -= Time.deltaTime;
			}
		}
	}

	// Token: 0x060007A4 RID: 1956 RVA: 0x0002D120 File Offset: 0x0002B320
	private void Update_FlushAndTear(bool force)
	{
		float b = 0.5882353f;
		if (this.nowFlushRate != base.FlushRate || force)
		{
			if (force)
			{
				this.nowFlushRate = base.FlushRate;
			}
			else
			{
				this.nowFlushRate = Tween.LinearMove(this.nowFlushRate, base.FlushRate, Time.deltaTime);
			}
			Color color = this.flushMat.color;
			color.a = Mathf.Lerp(0f, b, this.nowFlushRate);
			this.flushMat.color = color;
		}
		if (this.nowTearsRate != base.TearsRate || force)
		{
			if (force)
			{
				this.nowTearsRate = base.TearsRate;
			}
			else
			{
				this.nowTearsRate = Tween.LinearMove(this.nowTearsRate, base.TearsRate, Time.deltaTime);
			}
			for (int i = 0; i < this.tears.Length; i++)
			{
				Color color2 = this.tears[i].material.color;
				color2.a = Mathf.Lerp(0f, b, this.nowTearsRate);
				this.tears[i].material.color = color2;
			}
		}
	}

	// Token: 0x060007A5 RID: 1957 RVA: 0x0002D250 File Offset: 0x0002B450
	protected override float GetVolume()
	{
		if (this.heroineID == HEROINE.RITSUKO)
		{
			return ConfigData.VolumeVoice_Ritsuko();
		}
		if (this.heroineID == HEROINE.AKIKO)
		{
			return ConfigData.VolumeVoice_Akiko();
		}
		if (this.heroineID == HEROINE.YUKIKO)
		{
			return ConfigData.VolumeVoice_Yukiko();
		}
		if (this.heroineID == HEROINE.MARIKO)
		{
			return ConfigData.VolumeVoice_Akiko();
		}
		return 0f;
	}

	// Token: 0x060007A6 RID: 1958 RVA: 0x0002D2AC File Offset: 0x0002B4AC
	protected override float GetVoicePitch()
	{
		if (this.heroineID == HEROINE.RITSUKO)
		{
			return ConfigData.PitchVoice_Ritsuko();
		}
		if (this.heroineID == HEROINE.AKIKO)
		{
			return ConfigData.PitchVoice_Akiko();
		}
		if (this.heroineID == HEROINE.YUKIKO)
		{
			return ConfigData.PitchVoice_Yukiko();
		}
		if (this.heroineID == HEROINE.MARIKO)
		{
			return ConfigData.PitchVoice_Mariko();
		}
		return 1f;
	}

	// Token: 0x060007A7 RID: 1959 RVA: 0x0002D308 File Offset: 0x0002B508
	public override void Save(string file)
	{
		base.StartCoroutine(base.ToCharaPNG(file, "【PlayHome_Female】"));
	}

	// Token: 0x060007A8 RID: 1960 RVA: 0x0002D320 File Offset: 0x0002B520
	public override void Save(string file, Texture2D tex)
	{
		base.ToCharaPNG(file, "【PlayHome_Female】", tex);
	}

	// Token: 0x060007A9 RID: 1961 RVA: 0x0002D330 File Offset: 0x0002B530
	public override void SaveCoordinate(string file)
	{
		base.StartCoroutine(base.ToCoordinatePNG(file, "【PlayHome_FemaleCoordinate】"));
	}

	// Token: 0x060007AA RID: 1962 RVA: 0x0002D348 File Offset: 0x0002B548
	public override void SaveCoordinate(string file, Texture2D tex)
	{
		base.ToCoordinatePNG(file, "【PlayHome_FemaleCoordinate】", tex);
	}

	// Token: 0x060007AB RID: 1963 RVA: 0x0002D358 File Offset: 0x0002B558
	public override LOAD_MSG Load(string file, int filter = -1)
	{
		return base.Load(file, true, false, filter);
	}

	// Token: 0x060007AC RID: 1964 RVA: 0x0002D364 File Offset: 0x0002B564
	public override LOAD_MSG Load(TextAsset text, int filter = -1)
	{
		return base.Load(text, true, false, filter);
	}

	// Token: 0x060007AD RID: 1965 RVA: 0x0002D370 File Offset: 0x0002B570
	public override LOAD_MSG LoadCoordinate(string file, int filter = -1)
	{
		return base.LoadCoordinate(file, true, false, filter);
	}

	// Token: 0x060007AE RID: 1966 RVA: 0x0002D37C File Offset: 0x0002B57C
	public override LOAD_MSG LoadCoordinate(TextAsset text, int filter = -1)
	{
		return base.LoadCoordinate(text, true, false, filter);
	}

	// Token: 0x060007AF RID: 1967 RVA: 0x0002D388 File Offset: 0x0002B588
	public override void Apply()
	{
		if (base.charReference == null)
		{
			base.charReference = base.gameObject.GetOrAddComponent<CharReference>();
		}
		base.body.Load(base.gameObject, base.customParam.body);
		this.ChangeAreoraSize();
		base.charReference.CreateReferenceInfo(1UL, 1, base.gameObject);
		base.charReference.CreateReferenceInfo(8UL, 1, base.gameObject);
		base.head.Load(base.customParam.head);
		Observable.EveryLateUpdate().Take(1).Subscribe(delegate(long _)
		{
			base.head.SetupFaceMaterial();
		});
		base.charReference.CreateReferenceInfo(3UL, 1, base.head.Obj);
		Transform hairsParent = Transform_Utility.FindTransform(base.head.Obj.transform, "cf_J_FaceUp_ty");
		base.hairs.SetHairsParent(hairsParent);
		base.hairs.Load(base.customParam.hair);
		for (WEAR_TYPE wear_TYPE = WEAR_TYPE.TOP; wear_TYPE < WEAR_TYPE.NUM; wear_TYPE++)
		{
			base.wears.WearInstantiate(wear_TYPE, base.body.SkinMaterial, base.body.CustomHighlightMat_Skin);
		}
		base.wears.CheckShow(true);
		base.charReference.CreateReferenceInfo(9UL, 1, base.wears.objWear[0]);
		base.charReference.CreateReferenceInfo(10UL, 1, base.wears.objWear[1]);
		base.charReference.CreateReferenceInfo(14UL, 1, base.wears.objWear[2]);
		base.charReference.CreateReferenceInfo(15UL, 1, base.wears.objWear[3]);
		base.charReference.CreateReferenceInfo(11UL, 1, base.wears.objWear[4]);
		base.charReference.CreateReferenceInfo(12UL, 1, base.wears.objWear[5]);
		base.charReference.CreateReferenceInfo(13UL, 1, base.wears.objWear[6]);
		base.charReference.CreateReferenceInfo(16UL, 1, base.wears.objWear[8]);
		this.BustUVNormal();
		for (int i = 0; i < 10; i++)
		{
			base.accessories.AccessoryInstantiate(base.customParam.acce, i, false, null);
		}
		Resources.UnloadUnusedAssets();
		this.SetupDynamicBones();
		base.lipSync = base.GetComponentInChildren<AnimeLipSync>();
		base.blink = base.GetComponentInChildren<AnimeParamBlink>();
		base.HeadPosTrans = Transform_Utility.FindTransform(base.body.AnimatedBoneRoot, "aim");
		base.BrestPosTrans = Transform_Utility.FindTransform(base.body.AnimatedBoneRoot, "cf_J_Spine03");
		base.CrotchTrans = Transform_Utility.FindTransform(base.body.AnimatedBoneRoot, "cf_J_Kokan");
		this.SetupExpression();
		this.ChangeGagItem();
	}

	// Token: 0x060007B0 RID: 1968 RVA: 0x0002D660 File Offset: 0x0002B860
	public override void ApplyCoordinate()
	{
		for (WEAR_TYPE wear_TYPE = WEAR_TYPE.TOP; wear_TYPE < WEAR_TYPE.NUM; wear_TYPE++)
		{
			base.wears.WearInstantiate(wear_TYPE, base.body.SkinMaterial, base.body.CustomHighlightMat_Skin);
		}
		base.wears.CheckShow(true);
		this.BustUVNormal();
		for (int i = 0; i < 10; i++)
		{
			base.accessories.AccessoryInstantiate(base.customParam.acce, i, false, null);
		}
		Resources.UnloadUnusedAssets();
		this.SetupDynamicBones();
	}

	// Token: 0x060007B1 RID: 1969 RVA: 0x0002D6EC File Offset: 0x0002B8EC
	public override void ApplyHair()
	{
		Transform hairsParent = Transform_Utility.FindTransform(base.head.Obj.transform, "cf_J_FaceUp_ty");
		base.hairs.SetHairsParent(hairsParent);
		base.hairs.Load(base.customParam.hair);
	}

	// Token: 0x060007B2 RID: 1970 RVA: 0x0002D738 File Offset: 0x0002B938
	public override void ChangeHead()
	{
		base.ChangeHead("cf_J_FaceUp_ty");
		this.SetupExpression();
	}

	// Token: 0x060007B3 RID: 1971 RVA: 0x0002D74C File Offset: 0x0002B94C
	public override void OnShapeApplied()
	{
		this.BustUVNormal();
	}

	// Token: 0x060007B4 RID: 1972 RVA: 0x0002D754 File Offset: 0x0002B954
	private void BustUVNormal()
	{
		float num = base.customParam.body.shapeVals[CharDefine.cf_bodyshape_BustNo];
		float num2 = Mathf.Clamp01(num * 2f);
		this.bustNormalMgr.Lerp(num2);
		this.nipNormal.Rate = 1f - num2;
		base.wears.BustUVNormal(1f - num2);
	}

	// Token: 0x060007B5 RID: 1973 RVA: 0x0002D7B8 File Offset: 0x0002B9B8
	public void ChangeAreoraSize()
	{
		this.nipUVMgr.Lerp(base.customParam.body.areolaSize);
	}

	// Token: 0x060007B6 RID: 1974 RVA: 0x0002D7D8 File Offset: 0x0002B9D8
	public override void SetupDynamicBones()
	{
		DynamicBone[] componentsInChildren = base.hairs.HirsParent.GetComponentsInChildren<DynamicBone>(true);
		DynamicBone_Ver01[] componentsInChildren2 = base.hairs.HirsParent.GetComponentsInChildren<DynamicBone_Ver01>(true);
		DynamicBone_Ver02[] componentsInChildren3 = base.hairs.HirsParent.GetComponentsInChildren<DynamicBone_Ver02>(true);
		DynamicBoneCollider[] componentsInChildren4 = base.body.Obj.transform.GetComponentsInChildren<DynamicBoneCollider>(true);
		foreach (DynamicBone dynamicBone in componentsInChildren)
		{
			dynamicBone.m_Colliders.Clear();
			foreach (DynamicBoneCollider item in componentsInChildren4)
			{
				dynamicBone.m_Colliders.Add(item);
			}
		}
		foreach (DynamicBone_Ver01 dynamicBone_Ver in componentsInChildren2)
		{
			dynamicBone_Ver.m_Colliders.Clear();
			foreach (DynamicBoneCollider item2 in componentsInChildren4)
			{
				dynamicBone_Ver.m_Colliders.Add(item2);
			}
		}
		foreach (DynamicBone_Ver02 dynamicBone_Ver2 in componentsInChildren3)
		{
			dynamicBone_Ver2.Colliders.Clear();
			foreach (DynamicBoneCollider item3 in componentsInChildren4)
			{
				dynamicBone_Ver2.Colliders.Add(item3);
			}
		}
	}

	// Token: 0x060007B7 RID: 1975 RVA: 0x0002D954 File Offset: 0x0002BB54
	public void SetupExpression()
	{
		this.eyeLook = base.head.Obj.GetComponentInChildren<LookAtRotator>();
		this.eyeLook.Change(this.eyeLookType, this.eyeLookTarget, this.eyeLookForce);
		Renderer[] componentsInChildren = base.head.Obj.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer renderer in componentsInChildren)
		{
			if (renderer.name == "cf_O_namida01")
			{
				this.tears[0] = renderer;
			}
			else if (renderer.name == "cf_O_namida02")
			{
				this.tears[1] = renderer;
			}
			else if (renderer.name == "cf_O_namida03")
			{
				this.tears[2] = renderer;
			}
			for (int j = 0; j < renderer.materials.Length; j++)
			{
				if (renderer.materials[j].name.IndexOf("cf_M_f_hohoaka") == 0)
				{
					this.flushMat = renderer.materials[j];
					break;
				}
			}
		}
		this.SetTear(base.TearsRate, true);
		this.SetFlush(base.FlushRate, true);
		base.ExpressionPlay(0, this.eyeState, 0f);
		base.ExpressionPlay(1, this.mouthState, 0f);
		base.ExpressionPlay(2, this.lipSyncState, 0f);
		base.OpenEye(this.eyeOpen);
		base.OpenMouth(this.mouthOpen);
	}

	// Token: 0x060007B8 RID: 1976 RVA: 0x0002DADC File Offset: 0x0002BCDC
	public override void SetFlush(float rate, bool force = false)
	{
		base.FlushRate = rate;
		if (force)
		{
			this.Update_FlushAndTear(true);
		}
	}

	// Token: 0x060007B9 RID: 1977 RVA: 0x0002DAF4 File Offset: 0x0002BCF4
	public override void SetTear(float rate, bool force = false)
	{
		base.TearsRate = rate;
		if (force)
		{
			this.Update_FlushAndTear(true);
		}
	}

	// Token: 0x060007BA RID: 1978 RVA: 0x0002DB0C File Offset: 0x0002BD0C
	public override void CheckShow()
	{
		if (!base.visibleAll)
		{
			return;
		}
		base.wears.CheckShow(true);
	}

	// Token: 0x060007BB RID: 1979 RVA: 0x0002DB28 File Offset: 0x0002BD28
	public int GetSpermLv(SPERM_POS _pos)
	{
		return this.sperms[(int)_pos];
	}

	// Token: 0x060007BC RID: 1980 RVA: 0x0002DB34 File Offset: 0x0002BD34
	public void SetSperm(SPERM_POS _pos, int _lv, bool _force = false)
	{
		int num = this.sperms[(int)_pos];
		_lv = (this.sperms[(int)_pos] = Mathf.Clamp(_lv, 0, 2));
		if (!_force && num == this.sperms[(int)_pos])
		{
			return;
		}
		switch (_pos)
		{
		case SPERM_POS.FACE:
			if (_lv != 0)
			{
				Female.ChangeSpermMaterial(base.head.Rend_skin, _lv, this.spermMat_face_lo, this.spermMat_face_hi);
				base.head.SetupFaceMaterialAndTexture();
				Renderer[] componentsInChildren = base.head.Obj.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer renderer in componentsInChildren)
				{
					for (int j = 0; j < renderer.sharedMaterials.Length; j++)
					{
						if (renderer.sharedMaterials[j].name.IndexOf("cf_M_f_hohoaka") == 0)
						{
							this.flushMat = renderer.sharedMaterials[j];
							break;
						}
					}
				}
				this.SetFlush(base.FlushRate, true);
			}
			else
			{
				this.DeleteSpermMaterials(base.head.Rend_skin, new string[]
				{
					this.spermMat_face_lo.name,
					this.spermMat_face_hi.name
				});
			}
			break;
		case SPERM_POS.BUST:
			if (_lv != 0)
			{
				Female.ChangeSpermMaterial(base.body.Rend_skin, _lv, this.spermMat_bust_lo, this.spermMat_bust_hi);
				base.body.SetupBodyMaterialAndTexture();
			}
			else
			{
				this.DeleteSpermMaterials(base.body.Rend_skin, new string[]
				{
					this.spermMat_bust_lo.name,
					this.spermMat_bust_hi.name
				});
			}
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
			break;
		case SPERM_POS.BACK:
			if (_lv != 0)
			{
				Female.ChangeSpermMaterial(base.body.Rend_skin, _lv, this.spermMat_back_lo, this.spermMat_back_hi);
				base.body.SetupBodyMaterialAndTexture();
			}
			else
			{
				this.DeleteSpermMaterials(base.body.Rend_skin, new string[]
				{
					this.spermMat_back_lo.name,
					this.spermMat_back_hi.name
				});
			}
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
			break;
		case SPERM_POS.CROTCH:
			if (_lv != 0)
			{
				Female.ChangeSpermMaterial(base.body.Rend_skin, _lv, this.spermMat_crotch_lo, this.spermMat_crotch_hi);
				base.body.SetupBodyMaterialAndTexture();
			}
			else
			{
				this.DeleteSpermMaterials(base.body.Rend_skin, new string[]
				{
					this.spermMat_crotch_lo.name,
					this.spermMat_crotch_hi.name
				});
			}
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
			break;
		case SPERM_POS.HIP:
			if (_lv != 0)
			{
				Female.ChangeSpermMaterial(base.body.Rend_skin, _lv, this.spermMat_hip_lo, this.spermMat_hip_hi);
				base.body.SetupBodyMaterialAndTexture();
			}
			else
			{
				this.DeleteSpermMaterials(base.body.Rend_skin, new string[]
				{
					this.spermMat_hip_lo.name,
					this.spermMat_hip_hi.name
				});
			}
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
			break;
		}
	}

	// Token: 0x060007BD RID: 1981 RVA: 0x0002DE94 File Offset: 0x0002C094
	public void AddSperm(SPERM_POS pos)
	{
		if (this.sperms[(int)pos] >= 2)
		{
			return;
		}
		this.sperms[(int)pos]++;
		int lv = this.sperms[(int)pos];
		if (pos == SPERM_POS.FACE)
		{
			Female.ChangeSpermMaterial(base.head.Rend_skin, lv, this.spermMat_face_lo, this.spermMat_face_hi);
			base.head.SetupFaceMaterialAndTexture();
			Renderer[] componentsInChildren = base.head.Obj.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer renderer in componentsInChildren)
			{
				for (int j = 0; j < renderer.sharedMaterials.Length; j++)
				{
					if (renderer.sharedMaterials[j].name.IndexOf("cf_M_f_hohoaka") == 0)
					{
						this.flushMat = renderer.sharedMaterials[j];
						break;
					}
				}
			}
			this.SetFlush(base.FlushRate, true);
		}
		else if (pos == SPERM_POS.BUST)
		{
			Female.ChangeSpermMaterial(base.body.Rend_skin, lv, this.spermMat_bust_lo, this.spermMat_bust_hi);
			base.body.SetupBodyMaterialAndTexture();
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
		}
		else if (pos == SPERM_POS.BACK)
		{
			Female.ChangeSpermMaterial(base.body.Rend_skin, lv, this.spermMat_back_lo, this.spermMat_back_hi);
			base.body.SetupBodyMaterialAndTexture();
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
		}
		else if (pos == SPERM_POS.CROTCH)
		{
			Female.ChangeSpermMaterial(base.body.Rend_skin, lv, this.spermMat_crotch_lo, this.spermMat_crotch_hi);
			base.body.SetupBodyMaterialAndTexture();
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
		}
		else if (pos == SPERM_POS.HIP)
		{
			Female.ChangeSpermMaterial(base.body.Rend_skin, lv, this.spermMat_hip_lo, this.spermMat_hip_hi);
			base.body.SetupBodyMaterialAndTexture();
			base.wears.ChangeBodyMaterial(base.body.Rend_skin);
		}
	}

	// Token: 0x060007BE RID: 1982 RVA: 0x0002E0B4 File Offset: 0x0002C2B4
	private static void ChangeSpermMaterial(Renderer rend, int lv, Material lo, Material hi)
	{
		int num = -1;
		for (int i = 0; i < rend.sharedMaterials.Length; i++)
		{
			if (rend.sharedMaterials[i].name == lo.name || rend.sharedMaterials[i].name == hi.name)
			{
				num = i;
				break;
			}
		}
		if (num == -1)
		{
			Material addMat = (lv != 1) ? hi : lo;
			MaterialUtility.AddSharedMaterials(rend, addMat);
		}
		else
		{
			Material mat = (lv != 1) ? hi : lo;
			MaterialUtility.SwapMaterials(rend, num, mat);
		}
	}

	// Token: 0x060007BF RID: 1983 RVA: 0x0002E158 File Offset: 0x0002C358
	public void ClearSpermMaterials()
	{
		for (int i = 0; i < this.sperms.Length; i++)
		{
			this.sperms[i] = 0;
		}
		this.DeleteSpermMaterials(base.head.Rend_skin);
		this.DeleteSpermMaterials(base.body.Rend_skin);
		base.wears.ChangeBodyMaterial(base.body.Rend_skin);
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x060007C0 RID: 1984 RVA: 0x0002E1C8 File Offset: 0x0002C3C8
	private void DeleteSpermMaterials(Renderer _rend, string[] _delMatNames)
	{
		List<Material> list = new List<Material>();
		Material[] sharedMaterials = _rend.sharedMaterials;
		Material[] array = sharedMaterials;
		for (int i = 0; i < array.Length; i++)
		{
			Material m = array[i];
			if (!_delMatNames.Any((string s) => m.name.IndexOf(s) == 0))
			{
				list.Add(m);
			}
		}
		if (sharedMaterials.Length != list.Count)
		{
			Material[] array2 = new Material[list.Count];
			for (int j = 0; j < list.Count; j++)
			{
				array2[j] = list[j];
			}
			_rend.sharedMaterials = array2;
		}
	}

	// Token: 0x060007C1 RID: 1985 RVA: 0x0002E280 File Offset: 0x0002C480
	private void DeleteSpermMaterials(Renderer rend)
	{
		string[] delMatNames = new string[]
		{
			this.spermMat_face_lo.name,
			this.spermMat_face_hi.name,
			this.spermMat_bust_lo.name,
			this.spermMat_bust_hi.name,
			this.spermMat_back_lo.name,
			this.spermMat_back_hi.name,
			this.spermMat_crotch_lo.name,
			this.spermMat_crotch_hi.name,
			this.spermMat_hip_lo.name,
			this.spermMat_hip_hi.name
		};
		this.DeleteSpermMaterials(rend, delMatNames);
	}

	// Token: 0x060007C2 RID: 1986 RVA: 0x0002E32C File Offset: 0x0002C52C
	public void SetVirginBlood(bool set)
	{
		this.ShowVirginBlood = set;
		Renderer rend_skin = base.body.Rend_skin;
		int num = -1;
		for (int i = 0; i < rend_skin.sharedMaterials.Length; i++)
		{
			if (rend_skin.sharedMaterials[i].name.IndexOf(this.virginBlood.name) == 0)
			{
				num = i;
				break;
			}
		}
		if (set)
		{
			if (num == -1)
			{
				MaterialUtility.AddSharedMaterials(rend_skin, this.virginBlood);
			}
		}
		else if (num != -1)
		{
			Material[] array = new Material[rend_skin.sharedMaterials.Length - 1];
			int num2 = 0;
			for (int j = 0; j < rend_skin.sharedMaterials.Length; j++)
			{
				if (j != num)
				{
					array[num2] = rend_skin.sharedMaterials[j];
					num2++;
				}
			}
			rend_skin.sharedMaterials = array;
			this.instancedVirginBlood = null;
		}
		base.wears.ChangeBodyMaterial(rend_skin);
	}

	// Token: 0x060007C3 RID: 1987 RVA: 0x0002E41C File Offset: 0x0002C61C
	public void ShowMosaic(bool show)
	{
		this.mosaicRoot.gameObject.SetActive(show);
	}

	// Token: 0x060007C4 RID: 1988 RVA: 0x0002E430 File Offset: 0x0002C630
	private void OnCollisionEnter(Collision col)
	{
		if (col.rigidbody.gameObject.layer == 12)
		{
			Transform transform = col.contacts[0].thisCollider.transform;
			Vector3 v = Quaternion.Inverse(transform.rotation) * col.rigidbody.velocity;
			this.HitSperm(transform.name, v);
		}
	}

	// Token: 0x060007C5 RID: 1989 RVA: 0x0002E494 File Offset: 0x0002C694
	public void HitSperm(string collisionName, Vector3 v)
	{
		SPERM_POS sperm_POS;
		if (collisionName.IndexOf("head") != -1 || collisionName.IndexOf("neck") != -1)
		{
			sperm_POS = SPERM_POS.FACE;
		}
		else if (collisionName.IndexOf("Mune") != -1 || collisionName.IndexOf("Spine03") != -1)
		{
			sperm_POS = SPERM_POS.BUST;
		}
		else if (collisionName.IndexOf("Spine02") != -1)
		{
			sperm_POS = SPERM_POS.BUST;
		}
		else
		{
			if (collisionName.IndexOf("Spine01") == -1 && collisionName.IndexOf("kosi") == -1)
			{
				return;
			}
			sperm_POS = SPERM_POS.CROTCH;
		}
		if ((double)v.z > 0.0)
		{
			if (sperm_POS == SPERM_POS.BUST)
			{
				sperm_POS = SPERM_POS.BACK;
			}
			else if (sperm_POS == SPERM_POS.CROTCH)
			{
				sperm_POS = SPERM_POS.HIP;
			}
		}
		if (this.spermHitTimer[(int)sperm_POS] <= 0f)
		{
			this.AddSperm(sperm_POS);
		}
		this.spermHitTimer[(int)sperm_POS] = 12f;
	}

	// Token: 0x060007C6 RID: 1990 RVA: 0x0002E588 File Offset: 0x0002C788
	public override void Foot(MapData.FOOT foot)
	{
		WEAR_SHOW show = (foot == MapData.FOOT.BARE) ? WEAR_SHOW.HIDE : WEAR_SHOW.ALL;
		WEAR_SHOW show2 = (foot != MapData.FOOT.SHOES) ? WEAR_SHOW.HIDE : WEAR_SHOW.ALL;
		base.wears.ChangeShow(WEAR_SHOW_TYPE.SOCKS, show);
		base.wears.ChangeShow(WEAR_SHOW_TYPE.SHOES, show2);
		this.CheckShow();
	}

	// Token: 0x060007C7 RID: 1991 RVA: 0x0002E5D4 File Offset: 0x0002C7D4
	public override void ChangeGagItem()
	{
		GAG_ITEM gagType = base.GagType;
		if (gagType == GAG_ITEM.BALLGAG)
		{
			if (this.gagItem == null)
			{
				GameObject obj = ResourceUtility.CreateInstance<GameObject>("mask_00");
				this.gagItem = new HumanAttachItem("mask_00", obj);
				base.AddAttachItem(this.gagItem);
			}
			Vector3[] array = new Vector3[]
			{
				new Vector3(0f, -1.5849f, 0.024f),
				new Vector3(0f, -1.6008f, 0.024f),
				new Vector3(0f, -1.5849f, 0.024f),
				new Vector3(0f, -1.551f, 0.0241f)
			};
			Vector3[] array2 = new Vector3[]
			{
				new Vector3(0.98f, 0.99f, 0.98f),
				new Vector3(0.95f, 1f, 0.98f),
				new Vector3(0.98f, 0.99f, 0.98f),
				new Vector3(0.96f, 0.97f, 0.98f)
			};
			Transform transform = base.head.Anime.transform;
			this.gagItem.obj.transform.SetParent(transform, false);
			this.gagItem.obj.transform.localPosition = array[base.customParam.head.headID];
			this.gagItem.obj.transform.localRotation = Quaternion.identity;
			this.gagItem.obj.transform.localScale = array2[base.customParam.head.headID];
		}
		else if (gagType == GAG_ITEM.GUMTAPE)
		{
			if (this.gagItem == null)
			{
				GameObject obj2 = ResourceUtility.CreateInstance<GameObject>("mask_01");
				this.gagItem = new HumanAttachItem("mask_01", obj2);
				base.AddAttachItem(this.gagItem);
			}
			float[] array3 = new float[]
			{
				0f,
				0f,
				0.002f,
				0.003f
			};
			float z = array3[base.customParam.head.headID];
			Transform parent = Transform_Utility.FindTransform(base.transform, "N_Mouth");
			this.gagItem.obj.transform.SetParent(parent, false);
			this.gagItem.obj.transform.localPosition = new Vector3(0f, 0f, z);
			this.gagItem.obj.transform.localRotation = Quaternion.identity;
			this.gagItem.obj.transform.localScale = Vector3.one;
		}
		this.ChangeShowGag(this.gagShow);
	}

	// Token: 0x060007C8 RID: 1992 RVA: 0x0002E8D4 File Offset: 0x0002CAD4
	public override void ChangeShowGag(bool flag)
	{
		this.gagShow = flag;
		bool flag2 = false;
		if (this.gagItem != null && this.gagItem.obj != null)
		{
			this.gagItem.obj.gameObject.SetActive(base.visibleAll & this.gagShow);
			flag2 = (base.visibleAll & this.gagShow);
		}
		if (base.lipSync != null)
		{
			base.lipSync.Hold = flag2;
		}
		if (base.head != null)
		{
			base.head.ResetMouth(flag2);
		}
		base.RePlayMouthExpression();
	}

	// Token: 0x060007C9 RID: 1993 RVA: 0x0002E978 File Offset: 0x0002CB78
	protected override string MouthExpressionCheck(string name)
	{
		if (base.GagType == GAG_ITEM.NONE || !this.gagShow)
		{
			if (name.Length == 0)
			{
				return "Mouth_Def";
			}
			return name;
		}
		else
		{
			if (base.GagType == GAG_ITEM.BALLGAG)
			{
				string[] array = new string[]
				{
					"GagA1",
					"GagA2",
					"GagA3",
					"GagB"
				};
				return array[base.customParam.head.headID];
			}
			if (base.GagType == GAG_ITEM.GUMTAPE)
			{
				return "Mouth_Def";
			}
			return name;
		}
	}

	// Token: 0x060007CA RID: 1994 RVA: 0x0002EA08 File Offset: 0x0002CC08
	protected override void ReAttachGag()
	{
		this.ChangeGagItem();
	}

	// Token: 0x060007CB RID: 1995 RVA: 0x0002EA10 File Offset: 0x0002CC10
	public static string HeroineName(HEROINE heroineID)
	{
		string[] array = new string[]
		{
			"律子",
			"明子",
			"雪子",
			"真理子"
		};
		string result = "- UNKNOWN -";
		if (heroineID >= HEROINE.RITSUKO && heroineID < HEROINE.NUM)
		{
			result = array[(int)heroineID];
		}
		return result;
	}

	// Token: 0x060007CC RID: 1996 RVA: 0x0002EA60 File Offset: 0x0002CC60
	public void SetNipAdd(float val)
	{
		this.NipAdd = val;
		int num = CharDefine.cf_bodyshapename.Length - 1;
		base.body.ShapeApply();
	}

	// Token: 0x060007CD RID: 1997 RVA: 0x0002EA8C File Offset: 0x0002CC8C
	public override void BodyShapeInfoApply()
	{
		int num = base.customParam.body.shapeVals.Length - 1;
		for (int i = 0; i < num; i++)
		{
			base.body.Info.ChangeValue(i, base.customParam.body.shapeVals[i]);
		}
		base.body.Info.ChangeValue(num, base.customParam.body.shapeVals[num] + this.NipAdd);
		base.body.Info.Update();
	}

	// Token: 0x060007CE RID: 1998 RVA: 0x0002EB20 File Offset: 0x0002CD20
	public void SetSkinSmoothAdd(float value)
	{
		this.SkinSmoothAdd = value;
		this.UpdateSkinMaterial();
		base.wears.ChangeBodyMaterial(base.body.Rend_skin);
	}

	// Token: 0x060007CF RID: 1999 RVA: 0x0002EB48 File Offset: 0x0002CD48
	public override void UpdateSkinMaterial()
	{
		base.customParam.body.skinColor.SetToMaterial(base.body.SkinMaterial, this.SkinSmoothAdd);
		base.customParam.body.skinColor.SetToMaterial(base.head.SkinMaterial, this.SkinSmoothAdd);
	}

	// Token: 0x060007D0 RID: 2000 RVA: 0x0002EBA4 File Offset: 0x0002CDA4
	public bool IsFloped()
	{
		return this.personality.IsFloped(this.heroineID);
	}

	// Token: 0x060007D1 RID: 2001 RVA: 0x0002EBB8 File Offset: 0x0002CDB8
	public static VISITOR HeroineIDtoVisitorID(HEROINE heroineID)
	{
		return (VISITOR)heroineID;
	}

	// Token: 0x060007D2 RID: 2002 RVA: 0x0002EBBC File Offset: 0x0002CDBC
	public static HEROINE VisitorIDtoHeroineID(VISITOR visitorID)
	{
		if (!Female.IsVisitorHeroine(visitorID))
		{
			GlobalData.Debug_LogError("不可转换为女主角");
			return HEROINE.NUM;
		}
		return (HEROINE)visitorID;
	}

	// Token: 0x060007D3 RID: 2003 RVA: 0x0002EBE4 File Offset: 0x0002CDE4
	public static bool IsVisitorHeroine(VISITOR visitorID)
	{
		return visitorID >= VISITOR.RITSUKO && visitorID < (VISITOR)4;
	}

	// Token: 0x060007D4 RID: 2004 RVA: 0x0002EC04 File Offset: 0x0002CE04
	public override void SetVisibleAll(bool _visible)
	{
		if (base.visibleAll == _visible)
		{
			return;
		}
		base.head.ChangeShow(_visible);
		base.hairs.ChangeShow(_visible);
		if (_visible)
		{
			base.visibleAll = _visible;
			for (int i = 0; i < 14; i++)
			{
				base.wears.ChangeShow((WEAR_SHOW_TYPE)i, this.wearShow[i]);
			}
		}
		else
		{
			WEAR_SHOW[] array = new WEAR_SHOW[14];
			for (int j = 0; j < 14; j++)
			{
				array[j] = base.wears.GetShow((WEAR_SHOW_TYPE)j, false);
				base.wears.ChangeShow((WEAR_SHOW_TYPE)j, WEAR_SHOW.HIDE);
			}
			for (int k = 0; k < 14; k++)
			{
				this.wearShow[k] = array[k];
			}
		}
		base.wears.CheckShow(_visible);
		if (_visible)
		{
			for (int l = 0; l < 10; l++)
			{
				base.accessories.SetShow(l, base.accessories.GetShow(l));
			}
		}
		else
		{
			base.accessories.ChangeAllShow(false);
		}
		if (_visible)
		{
			this.SetTongueType(base.TongueType);
		}
		else
		{
			base.body.SetShowTongue(false);
			base.head.SetShowTongue(false);
		}
		base.body.ShowNail(_visible);
		base.body.showUnderHair = _visible;
		this.ShowMosaic(_visible);
		if (_visible)
		{
			this.ChangeShowGag(this.gagShow);
		}
		else
		{
			bool gagShow = this.gagShow;
			this.ChangeShowGag(false);
			this.gagShow = gagShow;
		}
		base.visibleAll = _visible;
	}

	// Token: 0x060007D5 RID: 2005 RVA: 0x0002ED9C File Offset: 0x0002CF9C
	public void ChangeGagItem(GAG_ITEM _gag)
	{
		if (base.GagType != _gag && this.gagItem != null)
		{
			base.DelAttachItem(this.gagItem.name);
			this.gagItem = null;
		}
		base.GagType = _gag;
		this.ChangeGagItem();
	}

	// Token: 0x0400078C RID: 1932
	private const string HeadParentName = "cf_J_Head_s";

	// Token: 0x0400078D RID: 1933
	private const string HairParentName = "cf_J_FaceUp_ty";

	// Token: 0x0400078E RID: 1934
	private const string DynammicBoneBustL_Name = "muneL";

	// Token: 0x0400078F RID: 1935
	private const string DynammicBoneBustR_Name = "muneR";

	// Token: 0x04000790 RID: 1936
	private const string MosaicRootName = "N_mnpb";

	// Token: 0x04000791 RID: 1937
	private const float SPERM_HIT_INTERVAL = 12f;

	// Token: 0x04000792 RID: 1938
	[SerializeField]
	private NormalData bustNormal;

	// Token: 0x04000793 RID: 1939
	[SerializeField]
	private UVNormalBlend nipNormal;

	// Token: 0x04000794 RID: 1940
	[SerializeField]
	private UVData nipUV;

	// Token: 0x04000795 RID: 1941
	private NormalLerpManager bustNormalMgr;

	// Token: 0x04000796 RID: 1942
	private UVLerpManager nipUVMgr;

	// Token: 0x04000797 RID: 1943
	private Renderer[] tears = new Renderer[3];

	// Token: 0x04000798 RID: 1944
	private Material flushMat;

	// Token: 0x04000799 RID: 1945
	private HEROINE heroineID = HEROINE.NUM;

	// Token: 0x0400079A RID: 1946
	[SerializeField]
	private Material spermMat_face_lo;

	// Token: 0x0400079B RID: 1947
	[SerializeField]
	private Material spermMat_face_hi;

	// Token: 0x0400079C RID: 1948
	[SerializeField]
	private Material spermMat_bust_lo;

	// Token: 0x0400079D RID: 1949
	[SerializeField]
	private Material spermMat_bust_hi;

	// Token: 0x0400079E RID: 1950
	[SerializeField]
	private Material spermMat_back_lo;

	// Token: 0x0400079F RID: 1951
	[SerializeField]
	private Material spermMat_back_hi;

	// Token: 0x040007A0 RID: 1952
	[SerializeField]
	private Material spermMat_crotch_lo;

	// Token: 0x040007A1 RID: 1953
	[SerializeField]
	private Material spermMat_crotch_hi;

	// Token: 0x040007A2 RID: 1954
	[SerializeField]
	private Material spermMat_hip_lo;

	// Token: 0x040007A3 RID: 1955
	[SerializeField]
	private Material spermMat_hip_hi;

	// Token: 0x040007A4 RID: 1956
	[SerializeField]
	private Material virginBlood;

	// Token: 0x040007A5 RID: 1957
	public ParticleSystem urineParticle;

	// Token: 0x040007A6 RID: 1958
	public ParticleSystem femaleEjaculationParticle;

	// Token: 0x040007A7 RID: 1959
	public ParticleSystem dripParticleVagina;

	// Token: 0x040007A8 RID: 1960
	public ParticleSystem dripParticleAnus;

	// Token: 0x040007A9 RID: 1961
	public ParticleSystem dripParticleMouth;

	// Token: 0x040007AA RID: 1962
	private int[] sperms = new int[5];

	// Token: 0x040007AB RID: 1963
	private float[] spermHitTimer = new float[5];

	// Token: 0x040007AC RID: 1964
	private Transform mosaicRoot;

	// Token: 0x040007AD RID: 1965
	private bool showMosaic = true;

	// Token: 0x040007B1 RID: 1969
	private Material instancedVirginBlood;
}
